Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support buffers with varying line heights #10

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

trevorpogue
Copy link
Owner

Fix bug present in buffers with (some or all) lines that are taller than the default-line-height.

In buffers fitting the above description, the bug:

  • Made topspace height change by an unexpected amount when point went below window-end during scrolling
  • Made topspace-recenter-buffer and recenter commands center buffer & cursor inaccurately

Checklist

  • I have read the topspace contributing guidelines
  • My changes follow the Emacs Lisp conventions and the Emacs Lisp Style Guide
  • I've used the latest version of package-lint to check for packaging issues, and addressed its feedback
  • The new code is not generating bytecode warnings
  • I've updated the readme (if adding/changing user-visible functionality)
  • I have confirmed some of these without doing them

@trevorpogue trevorpogue added the bug Something isn't working label Mar 31, 2022
@trevorpogue trevorpogue merged commit bdf5d43 into main Mar 31, 2022
@trevorpogue trevorpogue deleted the different-line-heights branch March 31, 2022 03:39
trevorpogue added a commit that referenced this pull request Mar 31, 2022
- Fix issue from PR #10 that broke ability to scroll down when in terminal:
  Resolved by making the line height calculations on integers instead of
  floating-point when in terminal.

- Fix minor issue from PR #10 caused when scrolling with mouse:
  When mouse scrolled the buffer all the way down it made the top space
  unexpectedly jump. This was resolved by lowering topspace command hook
  priorities such that the hooks are run sooner in the list.
trevorpogue added a commit that referenced this pull request Mar 31, 2022
- PR #10 introduced a bug where scrolling doesn't working as expected
  when Emacs is run in terminal. The fix for this in the previous commit
  was not sufficient. This commit fixes the source of the problem,
  which was that floats were being passed to
  scroll-up/scroll-down from the added advice functions, but that
  seems to be invalid when in terminal. So now only integers are being passed
  to scroll-up/scroll-down when in terminal.
trevorpogue added a commit that referenced this pull request Apr 15, 2022
- The buffer would get scrolled up too far by one line when scrolling
  text up in the following condition: top space was present before
  scrolling but not present after, and the top line in the buffer should
  be at the very top of the window after (but the bug made the second line
  be at the top of the window). This is resolved here.
- The technical reason for the bug was that 0.0 would be passed to `scroll-up`
  after `topspace--filter-args-scroll-up`, assuming that `scroll-up` would not
  scroll in this scenario, however it turns out that if
  `scroll-up`/`scroll-down` are passed a zero-valued float they will
  still scroll by one line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant